package cn.gson.springboot.controller.privilegecontroller;

import cn.gson.springboot.model.pjos.Emp;
import cn.gson.springboot.model.service.privilegeservice.DataControlService;
import cn.gson.springboot.model.vo.privilegevo.DeptPositionVo;
import cn.gson.springboot.model.vo.privilegevo.DeptVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class DataControlController {
    @Autowired
    DataControlService dataControlService;

    /** 查询用户是否是一级角色*/
    @RequestMapping("/is_one_Role")
    @ResponseBody
    public DeptPositionVo deptPost(Integer empId){
        return dataControlService.deptPost(empId);
    }

    /**
     * 一级用户能看到的部门信息
     * @param psetId
     * @param fatherDeptId
     * @return
     */
    @RequestMapping("/data")
    @ResponseBody
    public List<DeptVo> deptVoList(Integer psetId, Integer fatherDeptId){
        return dataControlService.childrenDept(psetId,fatherDeptId);
    }
    /**
     * 查询部门下的员工
     * */
    @RequestMapping("/dept_emp")
    @ResponseBody
    public List<Emp> selectEmp(Integer deptId){
        return dataControlService.selectEmp(deptId);
    }

}
